<script type="text/javascript">
    $(document).ready(function()
    {
        $( "#dialog-message" ).dialog( "close" );
        $( "#dialog-confirm-dels" ).dialog( "close" );
        $("#code_cd_all").click(function()				
        {
            var checked_status = this.checked;
            $("input[name=com_cd[]]").each(function()
            {
                this.checked = checked_status;
            });
        });
                $( "#dialog-confirm-dels" ).dialog({
                        autoOpen: false,
			resizable: false,
			height:170,
			modal: true,
			buttons: {
				"Delete": function() {
                                     $('#form_dels').submit();
				},
				Cancel: function() {                                 
                                     $( this ).dialog( "close" );
				}
			}
		});  
                $( "#dialog-message" ).dialog({
                        autoOpen: false,
			modal: true,
                        resizable: false,
                        height:160,
                        width:310,
			buttons: {
				Ok: function() {
					$( this ).dialog( "close" );
				}
			}
		}); 
                
                $( ".button-del" )
			.click(function() {
                       if ($("input:checked").length > 0 ){
                          $( "#dialog-confirm-dels" ).dialog( "open" );
                       }
                       else{
                          $( "#dialog-message" ).dialog( "open" );
                       }
//                       $( "#dialog-confirm-dels" ).dialog( "open" );	
                });
                               
    });
</script>
<div class="content">
    <div class="content-header">
        <h3>Poli</h3>
        <div class="content-nav">
            <ul>
                <li><a href="{$strUrladd|default:''}"><img src="{$BASEURL|default:''}/resource/doc/icon/add.png" alt="" />Tambah</a></li>
                <li><a class="nav-active" href="{$strUrllist|default:''}"><img src="{$BASEURL|default:''}/resource/doc/icon/list.png" alt="" />List</a></li>
            </ul>
        </div>
        <div class="clear"></div>
    </div>
    {include file="base/templates/notification.html"}
    <div class="paging">
        {$strPagination}
    </div>
    <form accept-charset="utf-8" method="post" action="{$strUrldel|default:''}" id="form_dels">
        <table width="100%" class="table-view">
            <tbody> 
                <tr>
                    <th width="1%"><input type="checkbox" id="code_cd_all"/></th>
                    <th width="10%">Kode Poli</th>
                    <th width="20%">Nama Poli</th>                
                    <th width="10%"></th>
                </tr> 
                {if $strPoli}
                {foreach $strPoli as $strPolis}
                <tr>
                    <td align="center"><input type="checkbox" name="id_Poli[]" value="{$strPolis['id_Poli']|default:''}" /></td>
                    <td>{$strPolis['id_poli']}</td>
                    <td>{$strPolis['nama']}</td>
                    <td align="right">
                    <a class="button" href="{$strUrledit}/{$strPolis['id_poli']|default:''}">Edit</a>
                    </td>
                </tr>
                {/foreach}
                    
                <tr class="action">
                    <td align="left" colspan="4">
                        <input type="button" name="" value="Hapus" class="button-del"/>
                    </td>
                </tr>
                {else}
                <tr style="border-bottom: 1px solid #B4B4B4">
                    <td colspan="4" style="font-size: 15px;font-weight: bold" align="center">Data Kosong</td>
                </tr>
                {/if}
            </tbody>
        </table>
    </form> 
    <div id="dialog-confirm-dels" title="Delete Code">
    <p style="font-size: 12px"><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Apakah Anda yakin akan mengahapus data yang di centang?</p>
   
    </div>
    <div id="dialog-message" title="Message" >
	<p style="font-size: 12px">
		<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
		Centang dulu data yang akan di hapus !.
	</p>
	
    </div>
</div>